<?php
/**
 *
 * User: zhaomeng1
 * Date: 2019/5/14
 * Time: 11:14 AM
 *
 */


//udp
// nc -vuz  192.168.2.104 950

$host = '0.0.0.0';

$port = 9502;

$serv = new swoole_server($host,$port,SWOOLE_PROCESS,SWOOLE_SOCK_UDP);


$serv->on('packet',function ($serv,$data,$fd){
     $serv->sendto($fd['address'],$fd['port'],"server: $data");
     var_dump ($fd);
});

$serv->start();
